package com.longjianghuasheng.logistics.business.freight

import androidx.lifecycle.MutableLiveData
import com.longjianghuasheng.logistics.base.BaseMultiStateViewModel
import com.longjianghuasheng.logistics.business.home.ServiceType
import com.longjianghuasheng.logistics.entity.Company
import com.longjianghuasheng.logistics.entity.FreightResponse
import com.longjianghuasheng.logistics.ext.commit
import com.longjianghuasheng.logistics.ext.commit2
import com.longjianghuasheng.logistics.network.apiService
import com.longjianghuasheng.logistics.repository.request.HttpRequestCoroutine

class FreightViewModel : BaseMultiStateViewModel() {

    var id = 0



    var isFirst = true

    val result by lazy {
        MutableLiveData<ServiceType>()
    }

    fun service_type() {
        commit2({ HttpRequestCoroutine.service_type() }, result, isToastSuccess = false)

    }


    val freightResult by lazy {
        MutableLiveData<ArrayList<FreightResponse>>()
    }

    fun service_list2() {

        getData({ apiService.service_list2(id) }, freightResult)
    }

    val teamResult by lazy {
        MutableLiveData<ArrayList<Company>>()
    }

    fun team_work_list() {
        commit({ apiService.team_work_list() }, teamResult)
    }
}